package com.zhangj.alljvm.oom;

import java.util.Random;

/**
 * @ClassName OutOfMemoryErrorTest01
 * @Description
 * @Author zhangjie
 * @Date 2022/3/11 20:25
 * @Version 1.0
 */
public class OutOfMemoryErrorTest01 {
    public static void main(String[] args) {
        //修改堆最大为10M
        String str = "zhangj";

        System.out.println("Runtime.getRuntime().maxMemory() = " + Runtime.getRuntime().maxMemory());

        byte[] bytes = new byte[1024 * 1024 * 22];

        //出现java.lang.OutOfMemoryError: Java heap space
    }
}
